﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows;
using System.Windows.Controls;

namespace DataFileApplication_WPF.Extensions
{
    // 反向可见性转换器
    public class VisibilityConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value?.ToString() == EnumDataType.Boolean.ToString() && parameter.ToString() == "cbx")
            {
                return Visibility.Visible;
            }
            else if(value?.ToString() == EnumDataType.Boolean.ToString() && parameter.ToString() != "cbx")
            {
                return Visibility.Collapsed;
            }
            else if(value?.ToString() != EnumDataType.Boolean.ToString() && parameter.ToString() != "cbx")
            {
                return Visibility.Visible;
            }
            else
            {
                return Visibility.Collapsed;
            }
              
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
